<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %><%--
  Created by IntelliJ IDEA.
  User: cyc
  Date: 2021/9/29
  Time: 9:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>易买网 - 首页</title>
    <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css" />
    <script type="text/javascript" src="${pageContext.request.contextPath}/scripts/jquery-1.8.3.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/scripts/jquery.form.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/scripts/function.js"></script>
</head>
<body>
<div id="header" class="wrap">
    <div id="logo"><img src="${pageContext.request.contextPath}/images/logo.gif" /></div>
    <div class="help">
        <c:if test="${sessionScope.user!=null}"><a href="shopping.jsp" id="shoppingBag" class="shopping">购物车${sessionScope.shopList.size()}件</a></c:if>
        <c:if test="${sessionScope.user==null}"><a href="login.jsp">登录</a></c:if>
        <c:if test="${sessionScope.user!=null}"> <span style="color: red">${user.username}你好</span> </c:if>
        <a class="button" id="logout" href="javascript:void(0);">注销</a><a href="register.jsp">注册</a>
        <a href="CommentServlet">留言</a>
        <a href="login.jsp">后台管理</a>
    </div>
    <div class="navbar">
        <ul class="clearfix">
            <li class="current"><a href="#">首页</a></li>
            <li><a href="#">图书</a></li>
            <li><a href="#">百货</a></li>
            <li><a href="#">品牌</a></li>
            <li><a href="#">促销</a></li>
        </ul>
    </div>
</div>
<div id="childNav">
    <div class="wrap">
        <ul class="clearfix">
            <li class="first"><a href="#">音乐</a></li>
            <li><a href="#">影视</a></li>
            <li><a href="#">少儿</a></li>
            <li><a href="#">动漫</a></li>
            <li><a href="#">小说</a></li>
            <li><a href="#">外语</a></li>
            <li><a href="#">数码相机</a></li>
            <li><a href="#">笔记本</a></li>
            <li><a href="#">羽绒服</a></li>
            <li><a href="#">秋冬靴</a></li>
            <li><a href="#">运动鞋</a></li>
            <li><a href="#">美容护肤</a></li>
            <li><a href="#">家纺用品</a></li>
            <li><a href="#">婴幼奶粉</a></li>
            <li><a href="#">饰品</a></li>
            <li class="last"><a href="#">Investor Relations</a></li>
        </ul>
    </div>
</div>
<div id="position0" class="wrap">
    您现在的位置：<a href="index.jsp">易买网</a> &gt; 结账
</div>
<div id="main" class="wrap">
    <div class="lefter">
        <div class="box">
            <h2>商品分类</h2>
            <dl>
                <dt>图书音像</dt>
                <dd><a href="product-list.html">图书</a></dd>
                <dd><a href="product-list.html">音乐</a></dd>
                <dt>百货</dt>
                <dd><a href="product-list.html">运动健康</a></dd>
                <dd><a href="product-list.html">服装</a></dd>
                <dd><a href="product-list.html">家居</a></dd>
                <dd><a href="product-list.html">美妆</a></dd>
                <dd><a href="product-list.html">母婴</a></dd>
                <dd><a href="product-list.html">食品</a></dd>
                <dd><a href="product-list.html">手机数码</a></dd>
                <dd><a href="product-list.html">家具首饰</a></dd>
                <dd><a href="product-list.html">手表饰品</a></dd>
                <dd><a href="product-list.html">鞋包</a></dd>
                <dd><a href="product-list.html">家电</a></dd>
                <dd><a href="product-list.html">电脑办公</a></dd>
                <dd><a href="product-list.html">玩具文具</a></dd>
                <dd><a href="product-list.html">汽车用品</a></dd>
            </dl>
        </div>
    </div>
</div>
<div id="news" class="right-main">
    <h1>选择收货地址</h1>
    <div class="content">
        <form action="${pageContext.request.contextPath}/alipay/add" method="post" id="form">
            收货地址:<input name="addr" id="addr" type="button" ref="${user.id}" value="添加新地址" />
            <span id="span"></span> <br />
            <c:forEach items="${addressList}" var="i">
                <input name="address" type="radio" id="${i.id}"  value="${i.address}" /><span>${i.address}</span><br />
            </c:forEach>
            <input type="text" name="userid" value="${user.id}" style="display: none">
            <input type="text" name="cost" value="${cost}" style="display: none">
            <input type="text" name="loginname" value="${user.loginname}" style="display: none">
            <div class="button">  <input type="button" value="结账" id="btn" />    </div>



        </form>
    </div>
</div>
<div class="clear"></div>
<div id="position1" class="wrap"></div>
<div class="wrap">
    <div id="shopping"></div>
</div>
<div id="footer">
    Copyright &copy; 2010 北大青鸟 All Rights Reserved. 京ICP证1000001号
</div>
</body>
<script>
$(function (){
    $("#btn").click(function (){
        var data=$("form").serialize();
        var useraddress=$('input:radio:checked').next("span").text();
        $.post("${pageContext.request.contextPath}/alipay/add?useraddress="+useraddress,data,function (res){
            alert("付完款等待页面自动返回哦");
            location.href="${pageContext.request.contextPath}/shopping-result.jsp";
        },"json");
    });





});
</script>
</html>
